import 'package:trollee/generated/json/base/json_convert_content.dart';
import 'package:trollee/app/data/entities/user/user_entity.dart';

UserEntity $UserEntityFromJson(Map<String, dynamic> json) {
	final UserEntity userEntity = UserEntity();
	final String? userId = jsonConvert.convert<String>(json['userId']);
	if (userId != null) {
		userEntity.userId = userId;
	}
	final String? username = jsonConvert.convert<String>(json['username']);
	if (username != null) {
		userEntity.username = username;
	}
	final int? expiresIn = jsonConvert.convert<int>(json['expiresIn']);
	if (expiresIn != null) {
		userEntity.expiresIn = expiresIn;
	}
	final int? identityType = jsonConvert.convert<int>(json['identityType']);
	if (identityType != null) {
		userEntity.identityType = identityType;
	}
	final int? identityId = jsonConvert.convert<int>(json['identityId']);
	if (identityId != null) {
		userEntity.identityId = identityId;
	}
	final String? accessToken = jsonConvert.convert<String>(json['accessToken']);
	if (accessToken != null) {
		userEntity.accessToken = accessToken;
	}
	final String? refreshToken = jsonConvert.convert<String>(json['refreshToken']);
	if (refreshToken != null) {
		userEntity.refreshToken = refreshToken;
	}
	final int? groupId = jsonConvert.convert<int>(json['groupId']);
	if (groupId != null) {
		userEntity.groupId = groupId;
	}
	final List<dynamic>? perms = jsonConvert.convertListNotNull<dynamic>(json['perms']);
	if (perms != null) {
		userEntity.perms = perms;
	}
	final String? identityName = jsonConvert.convert<String>(json['identityName']);
	if (identityName != null) {
		userEntity.identityName = identityName;
	}
	final int? age = jsonConvert.convert<int>(json['age']);
	if (age != null) {
		userEntity.age = age;
	}
	return userEntity;
}

Map<String, dynamic> $UserEntityToJson(UserEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['userId'] = entity.userId;
	data['username'] = entity.username;
	data['expiresIn'] = entity.expiresIn;
	data['identityType'] = entity.identityType;
	data['identityId'] = entity.identityId;
	data['accessToken'] = entity.accessToken;
	data['refreshToken'] = entity.refreshToken;
	data['groupId'] = entity.groupId;
	data['perms'] =  entity.perms;
	data['identityName'] = entity.identityName;
	data['age'] = entity.age;
	return data;
}
